Runtime Environment
Contexts
__block
: the block context__transaction
the transaction context__debug
the debug context (debug only)
Transaction Context
All variables and functions are const.
enum transaction_type{
normal_type, // invoked by a normal transaction
relay_type, // invoked by a relay call
system_type, // invoked by the system (the reserved on_xxx() functions)
scheduled_type // invoked by a scheduled transaction
}
Name | Type | Description | N | R | S | S |
---|---|---|---|---|---|---|
get_type() | () -> transaction_type | get the type of transaction | X | X | X | X |
get_self_address() | () -> address | The address of this (not accessible from shard functions) | X | X | X | X |
get_sender() | () -> address | Returns the first signer of the transaction or the contract that called the current contract | X | X | X | X |
get_timestamp() | () -> uint64 | Timestamp of the transaction | X | X | X | X |
get_signers() | () -> array<address> | the number of signers | X | |||
verify_signer() | (uint32) -> bool | check the signature of a signer | X | |||
verify_signer() | (address) -> bool | check the signature of a signer | X | |||
get_originated_shard_index() | () -> uint32 | Index of the originate shard | X | |||
get_originated_shard_order() | () -> uint32 | Order of the originate shard | X | |||
get_initiator_address() | () -> address | Target address of originate transaction | X |
Block Context
All variables and functions are const.
Name | Type | Description |
---|---|---|
get_height() | () -> uint64 | Height of the block |
get_shard_index() | () -> uint32 | Index of the shard |
get_shard_order() | () -> uint32 | Order of the shard |
get_timestamp() | () -> uint64 | Timestamp of the block |
get_random_number() | () -> uint64 | get random number based on block metadata |
get_miner_address() | () -> address | get address of the block miner |
Debug Context
All variables and functions are const.
Name | Type | Description |
---|---|---|
assert() | (bool) -> void | if false: raise assertion failure exception and terminate execution |
assert() | (bool, string) -> void | if false: raise assertion failure exception and terminate execution, display the string in log |
print() | (arbitrary) -> void | print informational message |